// ----------------------------------------------整体-----------------------------------

import Cookie from './cookie.js'
import Api from  './api.js'
import Base_api from './Base_api.js'


new Vue({
    el:'#success',
    data(){
        return{
            order:[],
            uinfos:[],                  //------当前用户的所有信息
            activity:[],                //当前选中的餐厅信息
            applypeople:'',             //当前人数
            search:'',                  //------搜索框内容
            num:'',                     //第几个报名的
        }
    },
    methods: {
        pay() {
            var vNow = new Date();
            var sNow = "";
            sNow += String(vNow.getFullYear());
            sNow += String(vNow.getMonth() + 1);
            sNow += String(vNow.getDate());
            sNow += String(vNow.getHours());
            sNow += String(vNow.getMinutes());
            sNow += String(vNow.getSeconds());
            sNow += String(vNow.getMilliseconds());
            var body= "";
            body += this.uinfos.id+"-";
            body += this.activity.id+"-";
            body += this.order.applynumber;
            location.href='http://localhost:8080/pay?WIDout_trade_no='+sNow+"-"+body+'&WIDtotal_amount='+parseInt(this.activity.price)*parseInt(this.order.applynumber)+'&WIDsubject='+this.activity.title+
                '&WIDbody='+body
            // location.href='http://localhost:8080/pay2?WIDout_trade_no='+sNow+"-"+body+'&WIDtotal_amount='+parseInt(this.activity.price)*parseInt(this.order.applynumber)+'&WIDsubject='+this.activity.title+
            //     '&WIDbody='+body+
            //     '&userId='+this.uinfos.id+'&ActivityId='+this.activity.id+'&applynumber='+this.order.applynumber+'&type=pay'
        }
    },
    mounted() {
        //-------------加载页面初始化数据--------------------------
        if(sessionStorage.getItem("zh")==null){
            this.$alert('请先登录', '系统提示', {
                confirmButtonText: '确定',
                callback: action => {
                    this.$message({
                        type: 'warning',
                        message: '即将跳转到登录界面...'
                    });
                    location.href='./login.html'
                }
            });
        }else {
            this.order=JSON.parse(Cookie.getCookie("order"))
            this.uinfos=this.order.uinfos
            this.activity=this.order.activity
            this.applypeople=parseInt(this.order.applypeople)+1
        }

        //--------------------------------------------------------
    }
})